package com.ruoyi.service.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.domain.ServicePackagescombo;
import com.ruoyi.service.service.IServicePackagescomboService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 服务套餐与耗材包对照Controller
 * 
 * @author ZDL
 * @date 2024-10-21
 */
@RestController
@RequestMapping("/service/packagescombo")
public class ServicePackagescomboController extends BaseController
{
    @Autowired
    private IServicePackagescomboService servicePackagescomboService;

    /**
     * 查询服务套餐与耗材包对照列表
     */
    @PreAuthorize("@ss.hasPermi('service:packagescombo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServicePackagescombo servicePackagescombo)
    {
        startPage();
        List<ServicePackagescombo> list = servicePackagescomboService.selectServicePackagescomboList(servicePackagescombo);
        return getDataTable(list);
    }

    /**
     * 导出服务套餐与耗材包对照列表
     */
    @PreAuthorize("@ss.hasPermi('service:packagescombo:export')")
    @Log(title = "服务套餐与耗材包对照", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServicePackagescombo servicePackagescombo)
    {
        List<ServicePackagescombo> list = servicePackagescomboService.selectServicePackagescomboList(servicePackagescombo);
        ExcelUtil<ServicePackagescombo> util = new ExcelUtil<ServicePackagescombo>(ServicePackagescombo.class);
        util.exportExcel(response, list, "服务套餐与耗材包对照数据");
    }

    /**
     * 获取服务套餐与耗材包对照详细信息
     */
    @PreAuthorize("@ss.hasPermi('service:packagescombo:query')")
    @GetMapping(value = "/{packagescomboId}")
    public AjaxResult getInfo(@PathVariable("packagescomboId") Long packagescomboId)
    {
        return success(servicePackagescomboService.selectServicePackagescomboByPackagescomboId(packagescomboId));
    }

    /**
     * 新增服务套餐与耗材包对照
     */
    @PreAuthorize("@ss.hasPermi('service:packagescombo:add')")
    @Log(title = "服务套餐与耗材包对照", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ServicePackagescombo servicePackagescombo)
    {
        return toAjax(servicePackagescomboService.insertServicePackagescombo(servicePackagescombo));
    }

    /**
     * 修改服务套餐与耗材包对照
     */
    @PreAuthorize("@ss.hasPermi('service:packagescombo:edit')")
    @Log(title = "服务套餐与耗材包对照", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServicePackagescombo servicePackagescombo)
    {
        return toAjax(servicePackagescomboService.updateServicePackagescombo(servicePackagescombo));
    }

    /**
     * 删除服务套餐与耗材包对照
     */
    @PreAuthorize("@ss.hasPermi('service:packagescombo:remove')")
    @Log(title = "服务套餐与耗材包对照", businessType = BusinessType.DELETE)
	@DeleteMapping("/{packagescomboIds}")
    public AjaxResult remove(@PathVariable Long[] packagescomboIds)
    {
        return toAjax(servicePackagescomboService.deleteServicePackagescomboByPackagescomboIds(packagescomboIds));
    }
}
